package com.jwgf.queueprogramflash;

import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;

public class HexPageCallable implements Callable<List<HexPage>> {

    private String filePath;
    private int pageSize;

    public HexPageCallable(String filePath, int pageSize) {
        this.filePath = filePath;
        this.pageSize = pageSize;
    }

    @Override
    public List<HexPage> call() throws Exception {
        if (filePath.endsWith(".hex") && new File(filePath).exists()){
            HexParser hexParser = new HexParser();
            hexParser.parseFile(filePath);
            List<HexPage> listHexPage = hexParser.splitPage(pageSize);
            return listHexPage;
        }
        return null;
    }
}
